
inline void BigInt::Init(const int& i_value)
{
	m_value.push_back(abs(i_value));
	m_sign = i_value >= 0 ? 0 : 1;
}

inline void BigInt::SetValue(const int& i_value)
{
	m_value.clear();
	Init(i_value);
}

inline void BigInt::SetValue(const std::string& i_value)
{
	m_value.clear();
	Init(i_value);
}

inline const BigInt operator+(const BigInt& i_first, const BigInt& i_second)
{
	BigInt temp = i_first;
	temp+= i_second;

	return temp;
}

inline const BigInt operator-(const BigInt& i_first, const BigInt& i_second)
{
	BigInt temp = i_first;
	temp-= i_second;
	return temp;
}

inline const BigInt operator*(const BigInt& i_first, const BigInt& i_second)
{
	BigInt result = i_first;
	result*=i_second;
	return result;
}

inline const BigInt operator/(const BigInt& i_first, const BigInt& i_second)
{
	BigInt result = i_first;
	result/=i_second;
	return result;
}

inline const BigInt operator%(const BigInt& i_first, const BigInt& i_second)
{
	BigInt result = i_first;
	result%=i_second;
	return result;
}

inline const BigInt operator&(const BigInt& i_first, const BigInt& i_second)
{
	BigInt result = i_first;
	result&=i_second;
	return result;
}

inline const BigInt operator|(const BigInt& i_first, const BigInt& i_second)
{
	BigInt result = i_first;
	result|=i_second;
	return result;
}

inline BigInt& BigInt::operator%=(const BigInt& i_value)
{
	BigInt result=*this/i_value;
	
	return *this-=(i_value*result);
}

inline bool operator!=(const BigInt& first, const BigInt& second)
{
	return !(first==second);
}

inline bool BigInt::operator<(const BigInt& second)const
{
	/*Controllo se i numeri sono uguali. Se sono uguali ritorno false*/
	if(*this==second)
		return false;

	return !(*this>second);
}

inline bool BigInt::operator>=(const BigInt& second)const
{
	return (*this==second || *this>second);
}

inline bool BigInt::operator<=(const BigInt& second)const
{
	return (*this==second || *this<second);
}

inline const BigInt& BigInt::operator++()
{
	//++a
	return (*this+=BigInt(1));
}

inline const BigInt& BigInt::operator--()
{
	//--a
	return (*this-=BigInt(1));
}

inline const BigInt BigInt::operator<<(const BigInt& shift)const
{
	BigInt result=*this;
	
	result*=pow(BigInt(2),shift);

	return result;
}

inline BigInt& BigInt::operator<<=(const BigInt& shift)
{
	*this*=pow(BigInt(2),shift);
	return *this;
}

inline bool BigInt::isZero() const
{
	return m_value.size() == 1 && m_value.at(0) == 0;
}



